<?php

/**
 * dossier filter form base class.
 *
 * @package    forumCDE
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasedossierFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'numero'                  => new sfWidgetFormFilterInput(),
      'service_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('service'), 'add_empty' => true)),
      'type_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'add_empty' => true)),
      'formulairedef_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('formulairedef'), 'add_empty' => true)),
      'datedossier'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'demandeur_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('demandeur'), 'add_empty' => true)),
      'client_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('client'), 'add_empty' => true)),
      'codeclient'              => new sfWidgetFormFilterInput(),
      'nomclient'               => new sfWidgetFormFilterInput(),
      'prenomclient'            => new sfWidgetFormFilterInput(),
      'telclient'               => new sfWidgetFormFilterInput(),
      'mailclient'              => new sfWidgetFormFilterInput(),
      'participantsnotifier_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('participantsnotifier'), 'add_empty' => true)),
      'daterealsouhaitee'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'datereference'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'delaistandar'            => new sfWidgetFormFilterInput(),
      'ferme'                   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'fermetechnique'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'typeexternalref'         => new sfWidgetFormFilterInput(),
      'desctypeexternal_id'     => new sfWidgetFormFilterInput(),
      'external_id'             => new sfWidgetFormFilterInput(),
      'datedernierrelance'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'brouillon'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'enattente'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'raisonattente'           => new sfWidgetFormFilterInput(),
      'deleted'                 => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'urgent'                  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'justifurgence'           => new sfWidgetFormFilterInput(),
      'datedebuttraitement'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'datefintraitement'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'datefermeture'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'datefermeturetechnique'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'duree'                   => new sfWidgetFormFilterInput(),
      'referencedemande'        => new sfWidgetFormFilterInput(),
      'created_at'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'numero'                  => new sfValidatorPass(array('required' => false)),
      'service_id'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('service'), 'column' => 'id')),
      'type_id'                 => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('type'), 'column' => 'id')),
      'formulairedef_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('formulairedef'), 'column' => 'id')),
      'datedossier'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'demandeur_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('demandeur'), 'column' => 'id')),
      'client_id'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('client'), 'column' => 'id')),
      'codeclient'              => new sfValidatorPass(array('required' => false)),
      'nomclient'               => new sfValidatorPass(array('required' => false)),
      'prenomclient'            => new sfValidatorPass(array('required' => false)),
      'telclient'               => new sfValidatorPass(array('required' => false)),
      'mailclient'              => new sfValidatorPass(array('required' => false)),
      'participantsnotifier_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('participantsnotifier'), 'column' => 'id')),
      'daterealsouhaitee'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'datereference'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'delaistandar'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ferme'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'fermetechnique'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'typeexternalref'         => new sfValidatorPass(array('required' => false)),
      'desctypeexternal_id'     => new sfValidatorPass(array('required' => false)),
      'external_id'             => new sfValidatorPass(array('required' => false)),
      'datedernierrelance'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'brouillon'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'enattente'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'raisonattente'           => new sfValidatorPass(array('required' => false)),
      'deleted'                 => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'urgent'                  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'justifurgence'           => new sfValidatorPass(array('required' => false)),
      'datedebuttraitement'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'datefintraitement'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'datefermeture'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'datefermeturetechnique'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'duree'                   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'referencedemande'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('dossier_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'dossier';
  }

  public function getFields()
  {
    return array(
      'id'                      => 'Number',
      'numero'                  => 'Text',
      'service_id'              => 'ForeignKey',
      'type_id'                 => 'ForeignKey',
      'formulairedef_id'        => 'ForeignKey',
      'datedossier'             => 'Date',
      'demandeur_id'            => 'ForeignKey',
      'client_id'               => 'ForeignKey',
      'codeclient'              => 'Text',
      'nomclient'               => 'Text',
      'prenomclient'            => 'Text',
      'telclient'               => 'Text',
      'mailclient'              => 'Text',
      'participantsnotifier_id' => 'ForeignKey',
      'daterealsouhaitee'       => 'Date',
      'datereference'           => 'Date',
      'delaistandar'            => 'Number',
      'ferme'                   => 'Boolean',
      'fermetechnique'          => 'Boolean',
      'typeexternalref'         => 'Text',
      'desctypeexternal_id'     => 'Text',
      'external_id'             => 'Text',
      'datedernierrelance'      => 'Date',
      'brouillon'               => 'Boolean',
      'enattente'               => 'Boolean',
      'raisonattente'           => 'Text',
      'deleted'                 => 'Boolean',
      'urgent'                  => 'Boolean',
      'justifurgence'           => 'Text',
      'datedebuttraitement'     => 'Date',
      'datefintraitement'       => 'Date',
      'datefermeture'           => 'Date',
      'datefermeturetechnique'  => 'Date',
      'duree'                   => 'Number',
      'referencedemande'        => 'Number',
      'created_at'              => 'Date',
      'updated_at'              => 'Date',
    );
  }
}
